function Setup(){
		$('#content_blog').hide();
		$('#content_settings').hide();
		$('#content_users').hide();
		$('#content_permissions').hide();
		$('#content_posts').hide();
		$('#content_categories').hide();
		$('#content_maintenance').hide();
}
function ShowPage(page){
		$('#content_overview').hide();
		$('#content_blog').hide();
		$('#content_settings').hide();
		$('#content_users').hide();
		$('#content_permissions').hide();
		$('#content_posts').hide();
		$('#content_categories').hide();
		$('#content_maintenance').hide();
		
		$('#'+page).show();
}
function PostRequest(data,div,type){
	if(div=='input'){
		$.ajax({ 
			type: "POST", url: "action.php", data: data, success: function(xml){  $('#'+div).val(xml); }
		});
	}else{
		$.ajax({ 
			type: "POST", url: "action.php", data: data, success: function(xml){ ReplaceDiv(div,xml); }
		});
	}
}
function ReplaceDiv(div,xml){
	$('#'+div).html(xml);
}

// Blog

var ActiveBlogPost = 0;

function NewBlogPost(){
	title = $('#newposttitle').val();
	content = $('#newpostcontent').val();
	if(title!="" && content!=""){
		PostRequest('np=1&title='+title+'&content='+content,'blogsubmitresult','');
	}else{ alert('Inster Title and Content'); }
	$('#newposttitle').val('');
	$('#newpostcontent').val('');
	AdminBlogList(0);
}
function LoadBlogEntry(title,id){
	ActiveBlogPost = id;
	$('#newposttitle').val(title);
	PostRequest('ep=1&id='+id,'newpostcontent','input');
	$('#saveblogbtn').show();
	$('#newblogbtn').hide();
	$('#blogh3').html("Update Post");
}
function SaveBlogPost(){
	title = $('#newposttitle').val();
	content = $('#newpostcontent').val();
	id = ActiveBlogPost;
	if(id!='' && title!="" && content!=""){
		PostRequest('sp=1&id='+id+'&title='+title+'&content='+content,'blogsubmitresult','');
	}else{ alert('Inster Title and Content'); }
}
function DeleteBlogPost(){
	$('#newposttitle').val('');
	$('#newpostcontent').val('');
	id = ActiveBlogPost;
	if(id>0){
		PostRequest('dp=1&id='+id,'blogsubmitresult','');
	}else{ alert('Delete Error'); }
	AdminBlogList(0);
}
function AdminBlogList(offset){
	PostRequest('al=1&offset='+offset,'adminbloglist','');
}
function RestoreNewPostScreen(){
	$('#saveblogbtn').hide();
	$('#newblogbtn').show();
	$('#blogh3').html("Add Post");
	$('#newposttitle').val('');
	$('#newpostcontent').val('');
	$('#blogsubmitresult').html('');
}